<?php
	abstract class viewport {
		
		public function __construct(){
			$this->__content = null;
		}

		public function set_name($name){
			$this->__name = $name;
		}
	
		public function set_content($content){
			$this->__content = $content;
		}
		
		public function assign($name, $value){
			context::get("tpl")->assign($name,$value);
		}
		
		public function fetch($content = null){
			$content = $content ? $content : $this->__content;
			
			$tpl_name = $this->__name.".tpl";
			
		
			if ($path = context::get("path")->locate("viewports"._DRS.$tpl_name)){
				$tpl = context::get("tpl");
				
				#context::msg("include path : {$path}");
				
				$tpl->set_template_dir($path._DRS."viewports");
				$tpl->assign("viewport_content",$content);

				$content = $tpl->fetch($tpl_name);

				return $content;
				
			}else{
				context::get("io")->debug("unable to locate viewport template directory", IO_DEBUG_ERROR);
				
				return $this->__content;
			}
		}
		
		//override me!
		public function exec(){
			
		}

	}
?>
